package cn.antblog.jdk8.bean;

/**
 * @author YangJingyi
 * @date 2021-06-15 14:56
 */
public class Student {

    private String name;
    private Integer age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Student(String name, Integer age) {
        this.name = name;
        this.age = age;
    }

    public Student() {

    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }


//    去重 distinct 重写 equals  和 hashCode
//    @Override
//    public boolean equals(final Object obj) {
//        if (obj == null) {
//            return false;
//        }
//        final Student student = (Student) obj;
//        if (this == student) {
//            return true;
//        } else {
//            return (this.name.equals(student.name) && this.age == student.age);
//        }
//    }
//    @Override
//    public int hashCode() {
//        int hashno = 7;
//        hashno = 13 * hashno + (name == null ? 0 : name.hashCode());
//        return hashno;
//    }

}
